import os
from os.path import join


def getDirSize(dir):
    size = 0
    for root, dirs, files in os.walk(dir):
         size += sum([os.path.getsize(join(root, f)) for f in files])
        # for f in files:
        #     size += os.path.getsize(join(root, f ))
    return size


dirPath = '/Users/Once/PycharmProjects'
sz = getDirSize(dirPath)
print(sz)
